package com.leochan.shuniu.api;

import org.scribe.encoders.URLHelper;
import org.scribe.http.Request;
import org.scribe.http.Response;
import org.scribe.http.Verb;
import org.scribe.oauth.Token;

import com.leochan.shuniu.Global;
import com.leochan.utils.DebugUtils;

public class UserAPI extends BaseAPI {

	private static final String users_str = "http://api.shuniu.net/api/v1/users.json%s";

	private static final String Page = "page";
	private static final String Num_per_page = "num_per_page";

	// GET http://api.shuniu.net/api/v1/users.json
	public static void users(Token token, long network_id, int page,
			int num_per_page) {
		DebugUtils.printLogD();
		initParams(token);
		if (network_id != -1) {
			params.put(Network_id, network_id);
		}
		params.put(Page, page);
		params.put(Num_per_page, num_per_page);
		String format = String.format(users_str, URLHelper.queryString(params));
		DebugUtils.printLogD(format);
		Request req = new Request(Verb.GET, format);
		Response resp = req.send(Global.proxy);
		DebugUtils.printLogD(resp.getBody());
		DebugUtils.printLogD("====================================");
	}

}
